package net.lcheng.service.impl;

import net.lcheng.dao.OOrderMapper;
import net.lcheng.model.OOrder;
import net.lcheng.model.OOrderExample;
import net.lcheng.service.OOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by zwr on 2016/7/16 0016.
 */
@Service
public class OOrderServiceImpl implements OOrderService {
    @Resource
    private OOrderMapper mapper;
    @Override
    public List<OOrder> getOOrderByBuyerUserId(String buyerUserId ,Integer orderStatus) {
        OOrderExample example=new OOrderExample();
        if (orderStatus==null){
            example.or().andBuyerUserIdEqualTo(buyerUserId);
        }else if(orderStatus!=null){
            example.or().andBuyerUserIdEqualTo(buyerUserId).andOrderStatusEqualTo(orderStatus);
        }
        return mapper.selectByExample(example);
    }
    @Override
    public OOrder getOOrderByOrderId(String orderId) {
        return mapper.selectByPrimaryKey(orderId);
    }
}
